package com.itheima.ydd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.ydd.entity.YddUser;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Mapper接口
 */
@Mapper
public interface YddUserMapper extends BaseMapper<YddUser> {
    /**
     * Description:
     * date: 2022/3/3 11:39
     * @author: chp
     * @since JDK 1.8
     */

    @Select("select article_id from ydd_user_data where type=#{type} and  user_id=#{userId}")
    Integer[] getArticleIds(@Param("userId") Integer userId, @Param("type") Integer type);

    @Insert("insert  into ydd_user_data values (null,#{article_id},#{userId},#{type})")
    void save(@Param("type") Integer type, @Param("article_id") Integer article_id,@Param("userId") Integer userId);


    @Delete("delete  from ydd_user_data where article_id=#{article_id}  and user_id=#{userId}  and type=#{type}")
    void del(@Param("type") Integer type, @Param("article_id") Integer article_id,@Param("userId") Integer userId);
}
